Skip to content

XBRL Contexts and Units

Contexts and units provide the who, when, and in what measurement for every fact in an instance document.

Contexts

Every fact must reference a context. A context answers three questions:

1. Entity (Who?)

xml
<xbrli:entity>
  <xbrli:identifier scheme="http://www.cipc.co.za">2024/123456/07</xbrli:identifier>
</xbrli:entity>
  • scheme identifies the registration system (e.g., SEC CIK, CIPC registration number)
  • The value is the entity's identifier within that scheme

2. Period (When?)

Three period types:

Instant -- a single point in time (balance sheet items):

xml
<xbrli:period>
  <xbrli:instant>2024-12-31</xbrli:instant>
</xbrli:period>

Duration -- a time range (income statement items):

xml
<xbrli:period>
  <xbrli:startDate>2024-01-01</xbrli:startDate>
  <xbrli:endDate>2024-12-31</xbrli:endDate>
</xbrli:period>

Forever -- perpetual facts (rare):

xml
<xbrli:period>
  <xbrli:forever/>
</xbrli:period>

The period type in the context must match the periodType defined for the concept in the schema. An instant concept cannot be reported with a duration context.

3. Segment / Scenario (Optional Additional Qualifiers)

Used primarily for dimensional breakdowns:

xml
<xbrli:entity>
  <xbrli:identifier scheme="...">...</xbrli:identifier>
  <xbrli:segment>
    <xbrldi:explicitMember dimension="ifrs:GeographicAreas">
      ifrs:SouthAfrica
    </xbrldi:explicitMember>
  </xbrli:segment>
</xbrli:entity>
  • Segment is inside <xbrli:entity> -- entity-level breakdowns
  • Scenario is a sibling of entity and period -- hypothetical/analytical breakdowns
  • In practice, most implementations use segment for dimensional data

Units

Every numeric fact must reference a unit.

Simple Units (Currencies)

xml
<xbrli:unit id="ZAR">
  <xbrli:measure>iso4217:ZAR</xbrli:measure>
</xbrli:unit>

Uses ISO 4217 currency codes: USD, EUR, GBP, ZAR, JPY, etc.

Other Simple Units

xml
<xbrli:unit id="shares">
  <xbrli:measure>xbrli:shares</xbrli:measure>
</xbrli:unit>

<xbrli:unit id="pure">
  <xbrli:measure>xbrli:pure</xbrli:measure>
</xbrli:unit>
  • xbrli:shares -- share counts
  • xbrli:pure -- dimensionless numbers (ratios, percentages)

Compound Units (Divide)

For measures like "earnings per share":

xml
<xbrli:unit id="ZARperShare">
  <xbrli:divide>
    <xbrli:unitNumerator>
      <xbrli:measure>iso4217:ZAR</xbrli:measure>
    </xbrli:unitNumerator>
    <xbrli:unitDenominator>
      <xbrli:measure>xbrli:shares</xbrli:measure>
    </xbrli:unitDenominator>
  </xbrli:divide>
</xbrli:unit>

Context Reuse

Multiple facts can reference the same context. For example, all balance sheet items at year-end share the same instant context -- no need to duplicate it.

xml
<xbrli:context id="BS_2024">...</xbrli:context>

<ifrs:Assets contextRef="BS_2024" unitRef="ZAR" decimals="-3">10000000</ifrs:Assets>
<ifrs:Equity contextRef="BS_2024" unitRef="ZAR" decimals="-3">6000000</ifrs:Equity>
<ifrs:Liabilities contextRef="BS_2024" unitRef="ZAR" decimals="-3">4000000</ifrs:Liabilities>